package cn.cqs.redisitem.service;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class LinuxConditional implements Condition {

    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
        Environment env=conditionContext.getEnvironment();
        String property = env.getProperty("os.name");
        if (property.toLowerCase().contains("linux")) {
            return true;
        }
        return false;

    }
}
